﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Robocode;
using Robocode.Control;
using Robocode.Control.Events;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

namespace GPforRobocode
{
    public static class ExtensionMethods
    {
        // Deep clone
        public static T DeepClone<T>(this T a)
        {
            using (MemoryStream stream = new MemoryStream())
            {
                BinaryFormatter formatter = new BinaryFormatter();
                formatter.Serialize(stream, a);
                stream.Position = 0;
                return (T)formatter.Deserialize(stream);
            }
        }
    }

    class Program
    {

        static void Main(string[] args)
        {
            RobotTool.InitRobocode();
            RobotTool.CompileCsToDLL("Gen137BestBot1");
            RobotTool.Visible = true;
            RobotTool.RunBattle("GpRobot.Gen137BestBot1", "sample.Walls");
            Console.WriteLine("任意鍵結束");
            Console.Read();
            
            
             /*RobotTool.InitRobocode();
             GP MyGP = new GP();
             MyGP.Run();
             RobotTool.CloseRobocode();
             Console.WriteLine(MyGP.GetAnswer.Score);
            Console.WriteLine("任意鍵結束");
            Console.Read();*/
        }
    }
}
